package datasource.zhuocan.cn.druid;

import com.alibaba.druid.pool.DruidDataSourceFactory;

import javax.sql.DataSource;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.util.Properties;

/**
 * 版权：卓灿教育集团 版权所有
 * author :赵航
 *
 * @e-mail: zhaohangcn@gmail.com
 * time：2021/2/17
 * describe ：
 */
public class DruidDome1 {
    public static void main(String[] args) throws Exception {

        //文件可以放置到任何位置
        Properties pro = new Properties();
        InputStream resourceAsStream = DruidDome1.class.getClassLoader().getResourceAsStream("druid.properties");
        pro.load(resourceAsStream);

        DataSource dataSource = DruidDataSourceFactory.createDataSource(pro);
        Connection connection = dataSource.getConnection();
        System.out.println(connection);

    }
}
